package com.fourthGroup.controller;

import com.alibaba.fastjson2.JSON;
import com.fourthGroup.model.User;
import com.fourthGroup.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/user/{uid}")
    public User queryUserById(@PathVariable("uid")Integer uid)throws InterruptedException{


        log.info("查询用户信息{}", uid);
        User user = userService.queryUserById(uid);
        log.info("成功查询到用户信息：{}", JSON.toJSONString(user));

        return user;
    }
}
